    <script src="${ctx}/extends/jquery.min.js" type="text/javascript"></script>
    <div class="noteList">
        <div class="layui-tab layui-tab-brief">
            <div class="layui-btn-container" style="margin: 10px;">
                <a class="layui-btn layui-btn-sm" data-method="offset" data-type="auto" id="initialize" >
                    <i class="layui-icon layui-icon-refresh"></i>
                    <span>初始化全部按钮</span>
                </a>
                <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="clear" id="clear" >
                    <i class="layui-icon layui-icon-delete"></i>
                    <span>清除按钮配置</span>
                </a>

            </div>
            <table class="layui-table"  lay-filter="operatingList" id="operatingList" style="text-align: center;">
                <thead>
                <tr>

                    <th style="width: 100px;text-align: center;">序号</th>
                    <th style="width: 150px;text-align: center;">节点名</th>
                    <th style="width: 150px;text-align: center;">类型</th>
                    <th style="width: 150px;text-align: center;">操作按钮</th>
                    <th style="width: 150px;text-align: center;">管理</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>0</td>
                    <td>启动流程</td>
                    <td style="color:red">起始节点</td>
                    <td>
                        <!--起始节点按钮-->
                        <#if nodeButtonMap?? && (nodeButtonMap?size >0)>
                            <#if nodeButtonMap.start??>
                                <!--初始化过的-->
                                <#list nodeButtonMap.start as btn>
                                    ${btn.btnname}<#sep>,</#sep>
                                </#list>
                            <#else>
                                <!--未初始化的-->
                                <#list initButtonMap.startEvent1 as btn>
                                    ${btn.text}<#sep>,</#sep>
                                </#list>
                            </#if>
                        <#else>
                            <!--未初始化的-->
                            <#list initButtonMap.startEvent1 as btn>
                                ${btn.text}<#sep>,</#sep>
                            </#list>
                        </#if>
                    </td>
                    <td>
                        <a class="layui-btn layui-btn-xs" layui-event="edit" onclick="editOne('${RequestParameters.modelId!}')">
                            <i class="layui-icon layui-icon-set"></i>编辑</a>
                        <a class="layui-btn layui-btn-xs" layui-event="init"  onclick="initOne('${RequestParameters.modelId!}')">
                            <i class="layui-icon layui-icon-refresh"></i>初始化</a>
                        <a class="layui-btn layui-btn-danger layui-btn-xs" layui-event="del"  onclick="delOne('${RequestParameters.modelId!}')">
                            <i class="layui-icon layui-icon-delete"></i>删除</a>
                    </td>
                    </tr>
                    <#list bpmNodeSetList as setlist>
                    <tr>
                        <td>${setlist_index+1}</td>
                        <td>${setlist.nodeName}
                            <input type="hidden" name="nodeId" value="${setlist.nodeId}"/>
                            <input type="hidden" name="nodeName" value="${setlist.nodeName}"/>
                        </td>
                        <td>
                            <#if taskMap.isSignNode >
                            会签节点
                            <#else>
                            普通节点
                        </#if>
                        </td>
                        <td>
                            <!--是否初始化全部按钮-->
                            <#if nodeButtonMap?? && (nodeButtonMap?size >0)>
                                <#list nodeButtonMap  as key >
                                    <!--初始化过的-->
                                    <#if nodeButtonMap["${setlist.nodeId}"]?? >
                                        <#list nodeButtonMap["${setlist.nodeId}"] as btn>
                                             ${btn.btnname}<#sep>,</#sep>
                                        </#list>
                                    <#else>
                                    <!--未初始化的-->
                                    <#if initButtonMap["${setlist.nodeId}"]?? >
                                        <#list initButtonMap["${setlist.nodeId}"] as btn>
                                            ${btn.text}<#sep>,</#sep>
                                        </#list>
                                         </#if>
                                    </#if>
                                </#list>
                            <#else>
                            <!--未初始化的-->
                                <#if initButtonMap["${setlist.nodeId}"]?? >
                                    <#list initButtonMap["${setlist.nodeId}"] as btn>
                                        ${btn.text}<#sep>,</#sep>
                                    </#list>
                                </#if>
                            </#if>
                    </td>
                    <td>
                        <a class="layui-btn layui-btn-xs" layui-event="edit"  onclick="editOne('${RequestParameters.modelId!}','${setlist.nodeId}')"><i class="layui-icon layui-icon-set"></i>编辑</a>
                        <a class="layui-btn layui-btn-xs" layui-event="init"  onclick="initOne('${RequestParameters.modelId!}','${setlist.nodeId}')"><i class="layui-icon layui-icon-refresh"></i>初始化</a>
                        <a class="layui-btn layui-btn-danger layui-btn-xs" layui-event="del"  onclick="delOne('${RequestParameters.modelId!}','${setlist.nodeId}')"><i class="layui-icon layui-icon-delete"></i>删除</a>
                    </td>
                    </tr>
                    </#list>
    </tbody>
    </table>

    </div>
    </div>



    <!--<script src="${ctx}/extends/jquery.min.js" type="text/javascript"></script>-->
    <script>
        function changeLoad(url){
            $("#settingDiv").height($("body.layui-layout-body").height()-110)
            $("#settingDiv").load(url);
        }
        //按钮接口跳转
        function gotoUrl(url) {
            changeLoad("${ctx}/workflow/bpmNodeButton/view"+url);
        }
        layer.config({
            skin: 'btn-class'
        })

        //弹出提示框
        $(function () {
            var isReturn = '${isReturn!}';
            if(isReturn=='true'){ layer.msg("操作成功！",{time:500,icon:6})}
            else if(isReturn=='false'){ layer.msg("操作失败！",{time:500,icon:5})}
        })

        //初始化全部按钮 接口
        $("#initialize").on('click',function () {
            layer.confirm('确认初始化全部按钮吗？', {
                icon:3
                , title: '提示'
            },function (index) {
                layer.close(index);
                gotoUrl("/initAll?modelId=${RequestParameters.modelId!}");
            })
        })
        //清除按钮配置 接口
        $("#clear").on('click',function () {
            layer.confirm('确认清除该流程定义的所有按钮吗？', {
                icon:3
                , title: '提示'
            },function (index) {
                layer.close(index);
                gotoUrl("/delByDefId?modelId=${RequestParameters.modelId!}");

            })
        });

        //编辑  接口
        function editOne(modelId, nodeId) {
            if (nodeId == null) {
                gotoUrl("/getByNode?modelId=" + modelId);
            } else {
                gotoUrl("/getByNode?modelId=" + modelId + "&&nodeId=" + nodeId);
            }
        }
        //初始化  接口
        function initOne(modelId, nodeId) {
            layer.confirm('确认初始化该流程节点的按钮吗？', {
                btn: ['是', '否']
                , title: '提示'
                , yes: function () {
                    if (nodeId == null) {
                        gotoUrl("/init?modelId=" + modelId);
                    } else {
                        gotoUrl("/init?modelId=" + modelId + "&&nodeId=" + nodeId);
                    }
                    layer.close(layer.index);
                }
            })
        }
        //删除 接口
        function delOne(modelId, nodeId) {
            layer.confirm('确认删除该流程节点的按钮吗？', {
                btn: ['是', '否']
                , title: '提示'
                , yes: function () {
                    if (nodeId == null) {
                        gotoUrl("/deByDefNodeId?modelId=" + modelId);
                    } else {
                        gotoUrl("/deByDefNodeId?modelId=" + modelId + "&&nodeId=" + nodeId);
                    }
                    layer.close(layer.index);
                }
            })
        }
    </script>
